<!-- 
  @name: 密码重置
  @date: 2020.3.13
 -->
<template>
	<view class="content">
		<view class="topview">
			<view>设置新密码</view>
			<view class="input">
				<input :password="true" class="int" placeholder="输入密码" placeholder-class="phcolor" v-model="userPwd" />
			</view>
		</view>
		
		<button class="btn_submit" @tap="submit">确认</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				staffId: '',  //账户id
				userPwd: '',  //密码
				userIdentity: 0,  //账号身份
			}
		},
		onLoad(e) {
			this.staffId = e.staffId;
			this.userIdentity = parseInt(e.userIdentity);
		},
		methods: {
			//提交
			submit() {
				if(!this.userPwd) {
					this.$showToast('请输入新的密码！');
					return;
				}
				this.$http({
					url: this.$api.accountUrl + 'updateaccount',
					data: {
						staffId: this.staffId,
						// userIdentity: this.userIdentity,
						type: 1,
						staffPwd: this.userPwd
					}
				}).then(res => {
					this.$successToast('保存成功！');
					this.$sucBack();
				});
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: $color-white;
	}
	
	.topview {
		width: 750rpx;
		padding: 80rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		.input {
			flex: 1;
			height: 80rpx;
			margin-left: 50rpx;
			padding: 0 40rpx;
			border-radius: 4rpx;
			border: 1rpx solid $color-grey-light;
			display: flex;
			align-items: center;
			.int {
				flex: 1;
			}
		}
	}
	
	.btn_submit {
		margin-top: 180rpx;
	}
	
</style>
